/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 jfinal app. jfapp Group.
 */

define(['adminapp'], function ($app) {
    $app.navactive('game_stat');

    var $listtable = $app.listtable({
        'sAjaxSource' : g.ctx + "admin/stat/game/detailList",
        'fnServerParams': function( aoData){
            aoData.push({'name' : 'gameId', 'value' : g.params.gameId});
            aoData.push({'name' : 'date', 'value' : g.params.date});

            var sd = $('#search_form').serializeJSON();
            $.each(sd, function(name, val){
                aoData.push({"name": name, "value": val});
            });
        },
        'bSort': false,
        'aoColumns'   : [
            $app.checkall,
            $app.autono,
            {'mDataProp': 'join_time' },
            /*{'mDataProp': 'wx_no' },*/
            {'mDataProp': 'card_no' },
            {'mDataProp': 'phone' },
            {'mDataProp': 'winning' },
            {'mDataProp': 'gift_name' }
        ],
        'aoColumnDefs': [
            {
                'aTargets' : [5],
                'mData'    : null,
                "bSortable": false,
                'mRender'  : function (data, type, full) {
                    if (full['winning']) {
                        return "中奖"
                    } else {
                        return "未中奖"
                    }
                }
            }
        ]
    }, 'data-list');

    $('#search_btn').on('click', function (e) {
        e.preventDefault();
        $listtable.fnReloadAjax();
    });
});

